package com.guo.rabbitmq.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author gonghuaiguo
 */
@RestController
public class ProducerController {

    @Resource
    private RabbitTemplate rabbitTemplate;

    @PostMapping("/sendMsg")
    public String sendMsg(String msg){
        rabbitTemplate.convertAndSend("","boot-hello1",msg);
        return "发送成功！";
    }
}
